1. Field of the Invention
In general, the present invention relates to a packet-data-processing apparatus. More particularly, the present invention relates to improvement of the speed of pipeline processing of packets with a variable length.
2. Description of the Related Art
A network node serving as a relay between IP (Internet Protocol) networks carries out packet processing such as modifying a header of a packet and searching a destination table provided in the apparatus of the node for a destination to which a packet is to be routed. With the improvement of the speed of transmission through the Internet achieved in recent years, it becomes necessary to increase the speed of packet processing carried out by a network node serving as a packet relay. Thus, such a network node employs special hardware for improving the speed of packet processing. In the conventional packet processing, there is adopted a store-and-forward configuration wherein a bus connects a memory to a packet-processing unit typically implemented by a processor or dedicated hardware for carrying out packet processing. To put it concretely, a received packet is stored temporarily in the memory to be subjected to packet processing carried out by the packet-processing unit. After the packet processing, the packet is transmitted to a switch fabric along with data such as information on a destination. The switch fabric searches a destination table for an output route indicated by the information on a destination and outputs the packet to the output route.
In addition, the network node also carries out processing based on information included in each protocol header as part of an operation to process an IP and a protocol of a lower layer. In general, only header information corresponding to the protocol is required for the processing, and no information in a data portion is required. This fact is referred to as processing locality. In order to improve the speed of processing, there has thus also been conceived a packet-data-processing unit having a configuration for carrying out a fixed number of processing steps corresponding to the transmission time of the data to be processed. If such locality exists in the packet processing or the packet processing involves only data up to an IP layer, the processing can be carried out at a high speed in a processing system employing the conceived packet-data-processing unit. On the other hand, the need for diversification of processing in a network node rises, making it necessary to process protocols higher than the IP layer. For example, there has been introduced a technology referred to as a VPN (Virtual Private Network), which allows a public network such as the Internet to be used by the user as a private network without being aware of the fact that the used network is actually a public network. In this VPN technology, there is a protocol for carrying out a tunneling process.
The tunneling is a method used in communication between two remotely located private networks through a public network such as the Internet. To put it concretely, a network node supporting the VPN technology adds a header for the public network to a packet received from a private network in a capsulating process. The network node then passes on the packet to another network node also supporting the VPN technology by way of the public network such as the Internet. The other network node located at another private network carries out a de-capsulating process to remove the header added during the capsulating process. The other network node then transmits the packet in a state prior to the capsulating process to the other private network. Take an L2TP as an example. The L2TP is a protocol requiring the tunneling process. To put it concretely, L2TP, UDP and IP headers are added to and deleted from a PPP packet in the tunneling process. Thus, a network node supporting the VPN technology carries out a capsulating process to add these headers and another network node supporting the VPN technology caries out a de-capsulating process to remove the headers.
In packet processing carried out in the conventional store-and-forward configuration, however, it is necessary to temporarily write packet data into a memory and read out the data back from the memory. Thus, this processing overhead causes a difficulty to speed-up the packet processing. As an entire packet data is stored into a memory at the store-and-forward processing, all the portion of the packet can be an object of processing. Thus, the store-and-forward configuration is capable of keeping up with any kind of processing. In a read operation, however, a processor reads out data from an addressed memory only after the processor supplies the address to the memory device. By the same token, in a write operation, a processor writes data into an address in the memory only after the processor supplies the address to the memory.
In general, however, a cycle time required for reading memory or writing data into memory is longer than a cycle time of a processor instruction. This is similar for the circuit which uses special hardware logic. An overhead of the operation to read out or write data from or into the memory causes the aforementioned problem, making it impossible to carry out the packet processing at a high speed.
In accordance with the technique of processing packet data by giving attention to the locality property of the processing, processing at an IP layer and lower layers can be carried out at a high speed. With this technique, however, it is difficult to store a result of a UDP checksum calculation even if the processor is capable of carrying out an addition repeatedly by executing the same instructions a number of times. This is because, since all the data portion of a UDP payload are used to calculate UDP checksum, the number of times the addition is repeated till completion which is dependent on the length of the packet. And the checksum has to be stored to the field in UDP header. Therefore, each step of calculating checksum itself has a locality, however, the distance between the position of the data where final result of the calculation is obtained and the position of the data where the result is to be stored is varied in dependence on the length of the packet. It is thus impossible to specify the location where the result is to be stored in an instruction to be executed by the packet-data processor that applies the so-called pipeline technique.
We provide a resister accessible by plural processors and a processor calculating checksum of the packet passes the result of processing on another processor accessible to the packet header through the register. With this technology, it may store a result obtained at the end of packet-data to a field of packet header. But it is possible that the checksum is overwritten by reason of the former processor completing process to next packet before the latter processor receives the result, because the length of the packet varies.
For the reason described above, it is difficult to carry out packet-data processing requiring a result of a UDP checksum computation by the prior pipeline technology. Therefore we must provide a general processor specially and assemble to have it the packet-data processing. With this technique, however, it is difficult to carry out the packet-data processing at a high speed.
It is thus an object of the present invention addressing the problems described above to provide a packet-data-processing apparatus capable of processing packets without causing the processing speed to decrease.
In accordance with an aspect of the present invention, there is provided a packet-data-processing apparatus for processing data of an input packet, the packet-data-processing apparatus comprising a first data-processing unit for computing information on a processing count based on the length of the input packet and outputting the information; a memory; a second data-processing unit for carrying out processing on pieces of data included in the input packet sequentially in accordance with the information on a processing count and storing a first result of processing at the end of the processing carried out on each of the pieces of data in the memory; an access control unit for reading out one of the first results of processing written into the memory least recently from the memory at a request for a read operation and deleting the first result of processing read out from the memory from the memory; a third data-processing unit for making the request for a read operation at reception of data at a predetermined position of the input packet by the third data-processing unit and carrying out processing based on the received input packet and the first result of processing read out by the access control unit at the request; and fourth data-processing unit constituting pipeline data-processing mechanism with said first and third data-processing unit and having latency longer than latency which said second data-processing unit needs to store said first result of processing for said packet with a greatest packet length packet into the memory. The packet-data-processing apparatus is characterized in that the memory provides a sufficient storage area for storing a first result of processing for an input packet having the longest latency since the first result of processing is generated till the first result of processing is supplied to said third data-processing unit.
It is desirable to provide a first set of shift registers connected to each other in cascade for each of the first to fourth data-processing units, and to have the first to fourth data-processing units each carry out processing based on the packet stored in the respective set of shift registers. In addition, it is also desirable to provide a second set of shift registers each for storing intermediate data related to the packet in parallel to the first set of shift registers.
The above and other objects, features and advantages of the present invention as well as the manner of realizing them will become more apparent whereas the invention itself will best understood from a careful study of the following description and appended claims with reference to attached drawings showing some preferred embodiments of the invention.